<html>
    <head>
        <meta charset="utf-8"> 
        <title>美业红</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">
        <script type='text/javascript' src='/public/js/jquery-1.11.2.min.js'></script>
        <script type="text/javascript" src='/public/js/jquery.validate.js'></script>  
        <link rel="stylesheet" href="/public/css/admin.css">
    </head>
    <body>
        <div class="table-responsive">
            <table  class="table table-striped table-bordered" style=" margin-top:3rem;"  >
                <thead>
                    <tr>
                        <th width="30%">建议内容</th>
                        <th width="10%">电话</th>
                        <th width="20%">插入时间</th>
                        <th width="10%">状态</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($list as $v){  ?>
                    <tr>
                        <td><?php $c = json_decode($v['content'],true);sort($c);echo $c[0];?></td>
                        <td><?php echo $v['mobile'];?></td>
                        <td><?php echo date('Y-m-d H:i:s',$v['create_time']);?></td>
                        <td><?php echo $v['status']==0?'<a onClick="dispose(this);" _id="'.$v['id'].'">处理</a>':'已处理'?></td>
                    </tr>
                    <?php }  ?>
                    <tr><td  colspan=6 align='center'><?php echo $page;?></td><tr>
                </tbody>   	
            </table>
        </div>
        <script type='text/javascript'>
            function dispose(obj){
                if(!confirm("确认操作？")){
                    return;
                }
                var url='/admin/suggest/dispose?id=';
                var id = $(obj).attr('_id');
                url = url + id;
                $.ajax({
                    url: url,
                    async: true, 
                    success: function (msg) {
                        if(msg == 'true'){
                            alert('处理成功');
                            $(obj).parent().html('已处理');
                        }else{
                            alert('处理失败');
                        }
                    }
                });
            }
        </script>
    </body>
</html>